﻿@model string
@using (Html.BeginForm("ExecuteUpdate", "System", Html.ViewContext.RouteData.Values, FormMethod.Post))
{
<div id="list-dept" style="text-align:center;margin-left:auto;margin-right:auto">
    @Html.TextArea("update_sql",Model,26,20,new { @style = "width: 99%;font-size:16px" }) 
    <table style="width:500px;text-align:center">
        <tr>
            <td style="width:100%"></td>
            <td style="width:100%;text-align:center">
                @Html.DevExpress().Button(settings =>
                {
                    settings.Name = "Button1";
                    settings.Text = "更新数据库";
                    //settings.Enabled = CurrentUser.CheckPermission(PermissionManager.填写GPS统计表);
                    settings.UseSubmitBehavior = false;
                    settings.Width = 100;
                    settings.ControlStyle.CssClass = "button1";
                    settings.ClientSideEvents.Click = "function(s, e){ commit_data();}";
                }).GetHtml()

            </td>
            <td>
                @Html.DevExpress().Button(settings =>
                {
                    settings.ControlStyle.CssClass = "button1";
                    settings.Name = "Button2";
                    settings.Text = "导出文件数据";
                    settings.Width = 120;
                    settings.ClientSideEvents.Click = "function(s, e){ download_data_dept();}";
                }).GetHtml()
            </td>
            <td>
                @Html.DevExpress().Button(settings =>
                {
                    settings.ControlStyle.CssClass = "button1";
                    settings.Name = "Button3";
                    settings.Text = "导出车辆数据";
                    settings.Width = 120;
                    settings.ClientSideEvents.Click = "function(s, e){ download_data_car();}";
                }).GetHtml()
            </td>
            <td>
                @Html.DevExpress().Button(settings =>
                {
                    settings.ControlStyle.CssClass = "button1";
                    settings.Name = "Button4";
                    settings.Text = "导出人员数据";
                    settings.Width = 120;
                    settings.ClientSideEvents.Click = "function(s, e){ download_data_user();}";
                }).GetHtml()
            </td>
            <td>
                @Html.DevExpress().Button(settings =>
                {
                    settings.ControlStyle.CssClass = "button1";
                    settings.Name = "Button5";
                    settings.Text = "导入数据";
                    settings.Width = 120;
                    settings.ClientSideEvents.Click = "function(s, e){ import_data();}";
                }).GetHtml()
            </td>
        </tr>
    </table>
    <span style="color:red;">@ViewBag.ExecuteMessage</span>
</div>
    <script type="text/javascript">
        function commit_data() {
            document.forms[0].action = '@Url.Action("ExecuteUpdate")';
            document.forms[0].submit();
        };
        function download_data_dept() {
            document.forms[0].action = '@Url.Action("ExportDeptXls")';
            document.forms[0].submit();
        };
        function download_data_car() {
            document.forms[0].action = '@Url.Action("ExportCarXls")';
            document.forms[0].submit();
        };
        function download_data_user() {
            document.forms[0].action = '@Url.Action("ExportUserXls")';
            document.forms[0].submit();
        };
        function import_data() {
            document.forms[0].action = '@Url.Action("Import")';
            document.forms[0].submit();
        };
    </script>
}



